/<template>
  <div class="views">
      <h3>分配视图权限</h3>
      <div>
          <!-- 获取身份权限信息 -->
            <el-select v-model="val1" placeholder="请选择">
                <el-option
                v-for="item in viewList"
                :key="item.type_id"
                :label="item.type_text"
                :value="item.type_id">
                </el-option>
            </el-select>
      </div>
      <div>
          <!-- 获取身份视图信息 -->
            <el-select v-model="val2" placeholder="请选择">
                <el-option
                v-for="item in authView"
                :key="item.views_id"
                :label="item.views_text"
                :value="item.views_id">
                </el-option>
            </el-select>
      </div>
      <button @click="submit">提交</button>
  </div>
</template>

<script>

import {mapActions,mapState} from 'vuex'

export default {
    data () {
        return {
            val1:"",
            val2:""
        }
    },
    methods: {
        ...mapActions(["getIdentity","getAuthView","setAuthIdentityViews"]),
        // 点击提交
        submit(){
            const type_id=this.val1
            const views_id=this.val2
            
            this.setAuthIdentityViews({type_id,views_id})
        }
    },
    mounted () {
        this.getIdentity(),
        this.getAuthView()
    },
    computed: {
        ...mapState(["viewList","authView"])
    }
}
</script>

<style>

</style>